package com.xy.pojo;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
    //设置表的主键，和主键策略，不设置默认使用ID_WORKER(3),
    @TableId(type = IdType.AUTO)
    private Long id;
    private String name;
    private Integer age;
    private String email;

    @Version//乐观锁Version注解
    private Integer version;

    @TableLogic//逻辑删除
    private Integer deleted;

    //设置自动填充，添加数据时，自动填充当前时间
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;
    //设置自动填充，添加数和修改数据时，自动当前时间
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;
}
